package cn.tedu.xuecha.controller;

import cn.tedu.xuecha.entity.dto.CommentCategoryDTO;
import cn.tedu.xuecha.respone.JsonResult;
import cn.tedu.xuecha.service.CommentCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author coinyang
 * @date 2023/4/22 12:48
 */
@Api(tags = "类目管理")
@RestController
@RequestMapping("category")
public class CategoryController {
    @Autowired
    CommentCategoryService commentCategoryService;


    @ApiOperation("分类查询")
    @GetMapping("/list")
    public JsonResult selectList(){

        return JsonResult.ok( commentCategoryService.selectList());
    }

    @ApiOperation("新增分类")
    @PostMapping("/addNewCategory")
    public JsonResult addNewCategory(CommentCategoryDTO commentCategoryDTO){
            commentCategoryService.addNewCategory(commentCategoryDTO);
        return JsonResult.ok();
    }
}
